<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="description" content="API docs for the didUpdateWidget method from the BoostContainerState class, for the Dart programming language.">
  <title>didUpdateWidget method - BoostContainerState class - boost_container library - Dart API</title>


  
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  
  <link rel="stylesheet" href="../../static-assets/github.css?v1">
  <link rel="stylesheet" href="../../static-assets/styles.css?v1">
  <link rel="icon" href="../../static-assets/favicon.png?v1">

  
</head>


<body data-base-href="../../"
      data-using-base-href="false">

<div id="overlay-under-drawer"></div>

<header id="title">
  <button id="sidenav-left-toggle" type="button">&nbsp;</button>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="../../index.html">flutter_boost</a></li>
    <li><a href="../../boost_container/boost_container-library.html">boost_container</a></li>
    <li><a href="../../boost_container/BoostContainerState-class.html">BoostContainerState</a></li>
    <li class="self-crumb">didUpdateWidget method</li>
  </ol>
  <div class="self-name">didUpdateWidget</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<main>


  <div id="dartdoc-main-content" class="main-content">
      <div>
<h1><span class="kind-method">didUpdateWidget</span> method 
</h1></div>

    <section class="multi-line-signature">
      
<div>
  <ol class="annotation-list">
    <li>@<a href="https://api.flutter.dev/flutter/dart-core/override-constant.html">override</a></li>
  </ol>
</div>

<span class="returntype">void</span>
<span class="name ">didUpdateWidget</span>(<wbr><ol class="parameter-list"><li><span class="parameter" id="didUpdateWidget-param-oldWidget"><span>covariant</span> <span class="type-annotation"><a href="../../boost_container/BoostContainerWidget-class.html">BoostContainerWidget</a></span> <span class="parameter-name">oldWidget</span></span></li>
</ol>)

      <div class="features">override</div>

    </section>
    
<section class="desc markdown">
  <p>Called whenever the widget configuration changes.</p>
<p>If the parent widget rebuilds and request that this location in the tree
update to display a new widget with the same <a href="https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html">runtimeType</a> and
<a href="https://api.flutter.dev/flutter/widgets/Widget/key.html">Widget.key</a>, the framework will update the <a href="https://api.flutter.dev/flutter/widgets/State/widget.html">widget</a> property of this
<a href="https://api.flutter.dev/flutter/widgets/State-class.html">State</a> object to refer to the new widget and then call this method
with the previous widget as an argument.</p>
<p>Override this method to respond when the <a href="https://api.flutter.dev/flutter/widgets/State/widget.html">widget</a> changes (e.g., to start
implicit animations).</p>
<p>The framework always calls <a href="../../boost_container/BoostContainerState/build.html">build</a> after calling <a href="../../boost_container/BoostContainerState/didUpdateWidget.html">didUpdateWidget</a>, which
means any calls to <a href="https://api.flutter.dev/flutter/widgets/State/setState.html">setState</a> in <a href="../../boost_container/BoostContainerState/didUpdateWidget.html">didUpdateWidget</a> are redundant.</p>
<p>If a <a href="https://api.flutter.dev/flutter/widgets/State-class.html">State</a>'s <a href="../../boost_container/BoostContainerState/build.html">build</a> method depends on an object that can itself
change state, for example a <a href="https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html">ChangeNotifier</a> or <a href="https://api.flutter.dev/flutter/dart-async/Stream-class.html">Stream</a>, or some
other object to which one can subscribe to receive notifications, then
be sure to subscribe and unsubscribe properly in <a href="../../boost_container/BoostContainerState/initState.html">initState</a>,
<a href="../../boost_container/BoostContainerState/didUpdateWidget.html">didUpdateWidget</a>, and <a href="../../boost_container/BoostContainerState/dispose.html">dispose</a>:</p>
<ul>
<li>In <a href="../../boost_container/BoostContainerState/initState.html">initState</a>, subscribe to the object.</li>
<li>In <a href="../../boost_container/BoostContainerState/didUpdateWidget.html">didUpdateWidget</a> unsubscribe from the old object and subscribe
to the new one if the updated widget configuration requires
replacing the object.</li>
<li>In <a href="../../boost_container/BoostContainerState/dispose.html">dispose</a>, unsubscribe from the object.</li>
</ul>
<p>Implementations of this method should start with a call to the inherited
method, as in <code>super.didUpdateWidget(oldWidget)</code>.</p>
</section>


    
<section class="summary source-code" id="source">
  <h2><span>Implementation</span></h2>
  <pre class="language-dart"><code class="language-dart">@override
void didUpdateWidget(covariant BoostContainerWidget oldWidget) {
  if (oldWidget != widget) {
    oldWidget.container.removeListener(refreshContainer);
    container.addListener(refreshContainer);
  }
  super.didUpdateWidget(oldWidget);
}</code></pre>
</section>


  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
  <form class="search-sidebar" role="search">
    <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
  <li><a href="../../index.html">flutter_boost</a></li>
  <li><a href="../../boost_container/boost_container-library.html">boost_container</a></li>
  <li><a href="../../boost_container/BoostContainerState-class.html">BoostContainerState</a></li>
  <li class="self-crumb">didUpdateWidget method</li>
</ol>


    <h5>BoostContainerState class</h5>
    <ol>

    <li class="section-title"><a href="../../boost_container/BoostContainerState-class.html#constructors">Constructors</a></li>
    <li><a href="../../boost_container/BoostContainerState/BoostContainerState.html">BoostContainerState</a></li>


    <li class="section-title">
      <a href="../../boost_container/BoostContainerState-class.html#instance-properties">Properties</a>
    </li>
    <li><a href="../../boost_container/BoostContainerState/container.html">container</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/widgets/State/context.html">context</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/hashCode.html">hashCode</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/widgets/State/mounted.html">mounted</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html">runtimeType</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/widgets/State/widget.html">widget</a></li>

    <li class="section-title"><a href="../../boost_container/BoostContainerState-class.html#instance-methods">Methods</a></li>
    <li><a href="../../boost_container/BoostContainerState/build.html">build</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/widgets/State/deactivate.html">deactivate</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/widgets/State/debugFillProperties.html">debugFillProperties</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/widgets/State/didChangeDependencies.html">didChangeDependencies</a></li>
    <li><a href="../../boost_container/BoostContainerState/didUpdateWidget.html">didUpdateWidget</a></li>
    <li><a href="../../boost_container/BoostContainerState/dispose.html">dispose</a></li>
    <li><a href="../../boost_container/BoostContainerState/initState.html">initState</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/widgets/State/reassemble.html">reassemble</a></li>
    <li><a href="../../boost_container/BoostContainerState/refreshContainer.html">refreshContainer</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/widgets/State/setState.html">setState</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/foundation/Diagnosticable/toDiagnosticsNode.html">toDiagnosticsNode</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html">toString</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/foundation/Diagnosticable/toStringShort.html">toStringShort</a></li>

    <li class="section-title inherited"><a href="../../boost_container/BoostContainerState-class.html#operators">Operators</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html">operator ==</a></li>




</ol>

  </div><!--/.sidebar-offcanvas-->

  <div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
  </div><!--/.sidebar-offcanvas-->

</main>

<footer>
  <span class="no-break">
    flutter_boost
      3.0.0
  </span>

  
</footer>



<script src="../../static-assets/highlight.pack.js?v1"></script>
<script src="../../static-assets/script.js?v1"></script>



</body>

</html>

